package com.free.chat.utils;

import org.noear.solon.core.handle.Context;

public class ServletUtil {

    /**
     * 根路径
     */
    private static final String ROOT_PATH = "api";

    /**
     * @Author: 朝花不迟暮
     * @Description: 获取当前地址＋根路径
     * @Date: 2022/11/13
     * @return: http://localhost:8080/api
     */
    public static String originUrl() {
        String url = Context.current().url();
        int i = url.indexOf(ROOT_PATH);
        return url.substring(0, i) + ROOT_PATH;
    }
}
